<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Bundler::CLI::Gem - bundler: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-ask_and_set">#ask_and_set</a>
    <li ><a href="#method-i-ask_and_set_ci">#ask_and_set_ci</a>
    <li ><a href="#method-i-ask_and_set_linter">#ask_and_set_linter</a>
    <li ><a href="#method-i-ask_and_set_test_framework">#ask_and_set_test_framework</a>
    <li ><a href="#method-i-bundler_dependency_version">#bundler_dependency_version</a>
    <li ><a href="#method-i-deprecated_rubocop_option">#deprecated_rubocop_option</a>
    <li ><a href="#method-i-ensure_safe_gem_name">#ensure_safe_gem_name</a>
    <li ><a href="#method-i-hint_text">#hint_text</a>
    <li ><a href="#method-i-open_editor">#open_editor</a>
    <li ><a href="#method-i-required_ruby_version">#required_ruby_version</a>
    <li ><a href="#method-i-resolve_name">#resolve_name</a>
    <li ><a href="#method-i-rubocop_version">#rubocop_version</a>
    <li ><a href="#method-i-run">#run</a>
    <li ><a href="#method-i-rust_builder_required_rubygems_version">#rust_builder_required_rubygems_version</a>
    <li ><a href="#method-i-standard_version">#standard_version</a>
    <li ><a href="#method-i-travis_removal_info">#travis_removal_info</a>
    <li ><a href="#method-i-validate_ext_name">#validate_ext_name</a>
    <li ><a href="#method-i-validate_rust_builder_rubygems_version">#validate_rust_builder_rubygems_version</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Bundler::CLI::Gem">
    <h1 id="class-Bundler::CLI::Gem" class="class">
      class Bundler::CLI::Gem
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="TEST_FRAMEWORK_VERSIONS">TEST_FRAMEWORK_VERSIONS
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-extension" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">extension</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-gem_name" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">gem_name</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-name" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">name</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-options" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">options</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-target" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">target</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-thor" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">thor</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(options, gem_name, thor)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">gem_name</span>, <span class="ruby-identifier">thor</span>)
  <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
  <span class="ruby-ivar">@gem_name</span> = <span class="ruby-identifier">resolve_name</span>(<span class="ruby-identifier">gem_name</span>)

  <span class="ruby-ivar">@thor</span> = <span class="ruby-identifier">thor</span>
  <span class="ruby-identifier">thor</span>.<span class="ruby-identifier">behavior</span> = <span class="ruby-value">:invoke</span>
  <span class="ruby-identifier">thor</span>.<span class="ruby-identifier">destination_root</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-ivar">@name</span> = <span class="ruby-ivar">@gem_name</span>
  <span class="ruby-ivar">@target</span> = <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">pwd</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">gem_name</span>)

  <span class="ruby-ivar">@extension</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:ext</span>]

  <span class="ruby-identifier">validate_ext_name</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@extension</span>
  <span class="ruby-identifier">validate_rust_builder_rubygems_version</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@extension</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;rust&quot;</span>
  <span class="ruby-identifier">travis_removal_info</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-run" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="run-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>
  <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">confirm</span> <span class="ruby-node">&quot;Creating gem &#39;#{name}&#39;...&quot;</span>

  <span class="ruby-identifier">underscored_name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-string">&quot;-&quot;</span>, <span class="ruby-string">&quot;_&quot;</span>)
  <span class="ruby-identifier">namespaced_path</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-string">&quot;-&quot;</span>, <span class="ruby-string">&quot;/&quot;</span>)
  <span class="ruby-identifier">constant_name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/-[_-]*(?![_-]|$)/</span>) { <span class="ruby-string">&quot;::&quot;</span> }.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/([_-]+|(::)|^)(.|$)/</span>) { <span class="ruby-node">$2</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-node">$3</span>.<span class="ruby-identifier">upcase</span> }
  <span class="ruby-identifier">constant_array</span> = <span class="ruby-identifier">constant_name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;::&quot;</span>)
  <span class="ruby-identifier">minitest_constant_name</span> = <span class="ruby-identifier">constant_array</span>.<span class="ruby-identifier">clone</span>.<span class="ruby-identifier">tap</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">-1</span>] = <span class="ruby-node">&quot;Test#{a[-1]}&quot;</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;::&quot;</span>) <span class="ruby-comment"># Foo::Bar =&gt; Foo::TestBar</span>

  <span class="ruby-identifier">use_git</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">git_present?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:git</span>]

  <span class="ruby-identifier">git_author_name</span> = <span class="ruby-identifier">use_git</span> <span class="ruby-operator">?</span> <span class="ruby-string">`git config user.name`</span>.<span class="ruby-identifier">chomp</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">git_username</span> = <span class="ruby-identifier">use_git</span> <span class="ruby-operator">?</span> <span class="ruby-string">`git config github.user`</span>.<span class="ruby-identifier">chomp</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">git_user_email</span> = <span class="ruby-identifier">use_git</span> <span class="ruby-operator">?</span> <span class="ruby-string">`git config user.email`</span>.<span class="ruby-identifier">chomp</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>

  <span class="ruby-identifier">github_username</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:github_username</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-identifier">git_username</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:github_username</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
    <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:github_username</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">config</span> = {
    <span class="ruby-value">:name</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">name</span>,
    <span class="ruby-value">:underscored_name</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">underscored_name</span>,
    <span class="ruby-value">:namespaced_path</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">namespaced_path</span>,
    <span class="ruby-value">:makefile_path</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;#{underscored_name}/#{underscored_name}&quot;</span>,
    <span class="ruby-value">:constant_name</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">constant_name</span>,
    <span class="ruby-value">:constant_array</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">constant_array</span>,
    <span class="ruby-value">:author</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">git_author_name</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;TODO: Write your name&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">git_author_name</span>,
    <span class="ruby-value">:email</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">git_user_email</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;TODO: Write your email address&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">git_user_email</span>,
    <span class="ruby-value">:test</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:test</span>],
    <span class="ruby-value">:ext</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">extension</span>,
    <span class="ruby-value">:exe</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:exe</span>],
    <span class="ruby-value">:bundler_version</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">bundler_dependency_version</span>,
    <span class="ruby-value">:git</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">use_git</span>,
    <span class="ruby-value">:github_username</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">github_username</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;[USERNAME]&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">github_username</span>,
    <span class="ruby-value">:required_ruby_version</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">required_ruby_version</span>,
    <span class="ruby-value">:rust_builder_required_rubygems_version</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">rust_builder_required_rubygems_version</span>,
    <span class="ruby-value">:minitest_constant_name</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">minitest_constant_name</span>,
  }
  <span class="ruby-identifier">ensure_safe_gem_name</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">constant_array</span>)

  <span class="ruby-identifier">templates</span> = {
    <span class="ruby-node">&quot;#{Bundler.preferred_gemfile_name}.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">preferred_gemfile_name</span>,
    <span class="ruby-string">&quot;lib/newgem.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;lib/#{namespaced_path}.rb&quot;</span>,
    <span class="ruby-string">&quot;lib/newgem/version.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;lib/#{namespaced_path}/version.rb&quot;</span>,
    <span class="ruby-string">&quot;sig/newgem.rbs.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;sig/#{namespaced_path}.rbs&quot;</span>,
    <span class="ruby-string">&quot;newgem.gemspec.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;#{name}.gemspec&quot;</span>,
    <span class="ruby-string">&quot;Rakefile.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;Rakefile&quot;</span>,
    <span class="ruby-string">&quot;README.md.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;README.md&quot;</span>,
    <span class="ruby-string">&quot;bin/console.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;bin/console&quot;</span>,
    <span class="ruby-string">&quot;bin/setup.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;bin/setup&quot;</span>,
  }

  <span class="ruby-identifier">executables</span> = <span class="ruby-node">%w[
    bin/console
    bin/setup
  ]</span>

  <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;gitignore.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.gitignore&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">use_git</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">test_framework</span> = <span class="ruby-identifier">ask_and_set_test_framework</span>
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:test</span>] = <span class="ruby-identifier">test_framework</span>
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:test_framework_version</span>] = <span class="ruby-constant">TEST_FRAMEWORK_VERSIONS</span>[<span class="ruby-identifier">test_framework</span>]

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">test_framework</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;rspec&quot;</span>
      <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(
        <span class="ruby-string">&quot;rspec.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.rspec&quot;</span>,
        <span class="ruby-string">&quot;spec/spec_helper.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;spec/spec_helper.rb&quot;</span>,
        <span class="ruby-string">&quot;spec/newgem_spec.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;spec/#{namespaced_path}_spec.rb&quot;</span>
      )
      <span class="ruby-identifier">config</span>[<span class="ruby-value">:test_task</span>] = <span class="ruby-value">:spec</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;minitest&quot;</span>
      <span class="ruby-comment"># Generate path for minitest target file (FileList[&quot;test/**/test_*.rb&quot;])</span>
      <span class="ruby-comment">#   foo     =&gt; test/test_foo.rb</span>
      <span class="ruby-comment">#   foo-bar =&gt; test/foo/test_bar.rb</span>
      <span class="ruby-comment">#   foo_bar =&gt; test/test_foo_bar.rb</span>
      <span class="ruby-identifier">paths</span> = <span class="ruby-identifier">namespaced_path</span>.<span class="ruby-identifier">rpartition</span>(<span class="ruby-string">&quot;/&quot;</span>)
      <span class="ruby-identifier">paths</span>[<span class="ruby-value">2</span>] = <span class="ruby-node">&quot;test_#{paths[2]}&quot;</span>
      <span class="ruby-identifier">minitest_namespaced_path</span> = <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;&quot;</span>)

      <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(
        <span class="ruby-string">&quot;test/minitest/test_helper.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;test/test_helper.rb&quot;</span>,
        <span class="ruby-string">&quot;test/minitest/test_newgem.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;test/#{minitest_namespaced_path}.rb&quot;</span>
      )
      <span class="ruby-identifier">config</span>[<span class="ruby-value">:test_task</span>] = <span class="ruby-value">:test</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;test-unit&quot;</span>
      <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(
        <span class="ruby-string">&quot;test/test-unit/test_helper.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;test/test_helper.rb&quot;</span>,
        <span class="ruby-string">&quot;test/test-unit/newgem_test.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;test/#{namespaced_path}_test.rb&quot;</span>
      )
      <span class="ruby-identifier">config</span>[<span class="ruby-value">:test_task</span>] = <span class="ruby-value">:test</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">config</span>[<span class="ruby-value">:ci</span>] = <span class="ruby-identifier">ask_and_set_ci</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">config</span>[<span class="ruby-value">:ci</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;github&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;github/workflows/main.yml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.github/workflows/main.yml&quot;</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;gitlab&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;gitlab-ci.yml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.gitlab-ci.yml&quot;</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;circle&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;circleci/config.yml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.circleci/config.yml&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ask_and_set</span>(<span class="ruby-value">:mit</span>, <span class="ruby-string">&quot;Do you want to license your code permissively under the MIT license?&quot;</span>,
    <span class="ruby-string">&quot;This means that any other developer or company will be legally allowed to use your code &quot;</span> \
    <span class="ruby-string">&quot;for free as long as they admit you created it. You can read more about the MIT license &quot;</span> \
    <span class="ruby-string">&quot;at https://choosealicense.com/licenses/mit.&quot;</span>)
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:mit</span>] = <span class="ruby-keyword">true</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-string">&quot;MIT License enabled in config&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;LICENSE.txt.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;LICENSE.txt&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ask_and_set</span>(<span class="ruby-value">:coc</span>, <span class="ruby-string">&quot;Do you want to include a code of conduct in gems you generate?&quot;</span>,
    <span class="ruby-string">&quot;Codes of conduct can increase contributions to your project by contributors who &quot;</span> \
    <span class="ruby-string">&quot;prefer collaborative, safe spaces. You can read more about the code of conduct at &quot;</span> \
    <span class="ruby-string">&quot;contributor-covenant.org. Having a code of conduct means agreeing to the responsibility &quot;</span> \
    <span class="ruby-string">&quot;of enforcing it, so be sure that you are prepared to do that. Be sure that your email &quot;</span> \
    <span class="ruby-string">&quot;address is specified as a contact in the generated code of conduct so that people know &quot;</span> \
    <span class="ruby-string">&quot;who to contact in case of a violation. For suggestions about &quot;</span> \
    <span class="ruby-string">&quot;how to enforce codes of conduct, see https://bit.ly/coc-enforcement.&quot;</span>)
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:coc</span>] = <span class="ruby-keyword">true</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-string">&quot;Code of conduct enabled in config&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;CODE_OF_CONDUCT.md.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;CODE_OF_CONDUCT.md&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ask_and_set</span>(<span class="ruby-value">:changelog</span>, <span class="ruby-string">&quot;Do you want to include a changelog?&quot;</span>,
    <span class="ruby-string">&quot;A changelog is a file which contains a curated, chronologically ordered list of notable &quot;</span> \
    <span class="ruby-string">&quot;changes for each version of a project. To make it easier for users and contributors to&quot;</span> \
    <span class="ruby-string">&quot; see precisely what notable changes have been made between each release (or version) of&quot;</span> \
    <span class="ruby-string">&quot; the project. Whether consumers or developers, the end users of software are&quot;</span> \
    <span class="ruby-string">&quot; human beings who care about what&#39;s in the software. When the software changes, people &quot;</span> \
    <span class="ruby-string">&quot;want to know why and how. see https://keepachangelog.com&quot;</span>)
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:changelog</span>] = <span class="ruby-keyword">true</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-string">&quot;Changelog enabled in config&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;CHANGELOG.md.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;CHANGELOG.md&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">config</span>[<span class="ruby-value">:linter</span>] = <span class="ruby-identifier">ask_and_set_linter</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">config</span>[<span class="ruby-value">:linter</span>]
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;rubocop&quot;</span>
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:linter_version</span>] = <span class="ruby-identifier">rubocop_version</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-string">&quot;RuboCop enabled in config&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;rubocop.yml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.rubocop.yml&quot;</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;standard&quot;</span>
    <span class="ruby-identifier">config</span>[<span class="ruby-value">:linter_version</span>] = <span class="ruby-identifier">standard_version</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-string">&quot;Standard enabled in config&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;standard.yml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;.standard.yml&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">&quot;exe/newgem.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;exe/#{name}&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">config</span>[<span class="ruby-value">:exe</span>]

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">extension</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;c&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(
      <span class="ruby-string">&quot;ext/newgem/extconf-c.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;ext/#{name}/extconf.rb&quot;</span>,
      <span class="ruby-string">&quot;ext/newgem/newgem.h.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;ext/#{name}/#{underscored_name}.h&quot;</span>,
      <span class="ruby-string">&quot;ext/newgem/newgem.c.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;ext/#{name}/#{underscored_name}.c&quot;</span>
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">extension</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;rust&quot;</span>
    <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">merge!</span>(
      <span class="ruby-string">&quot;Cargo.toml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;Cargo.toml&quot;</span>,
      <span class="ruby-string">&quot;ext/newgem/Cargo.toml.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;ext/#{name}/Cargo.toml&quot;</span>,
      <span class="ruby-string">&quot;ext/newgem/extconf-rust.rb.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;ext/#{name}/extconf.rb&quot;</span>,
      <span class="ruby-string">&quot;ext/newgem/src/lib.rs.tt&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;ext/#{name}/src/lib.rs&quot;</span>,
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">target</span>.<span class="ruby-identifier">directory?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;Couldn&#39;t create a new gem named `#{gem_name}` because there&#39;s an existing file named `#{gem_name}`.&quot;</span>
    <span class="ruby-identifier">exit</span> <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">BundlerError</span>.<span class="ruby-identifier">all_errors</span>[<span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">GenericSystemCallError</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">use_git</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;Initializing git repo in #{target}&quot;</span>
    <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;shellwords&quot;</span>
    <span class="ruby-node">`git init #{target.to_s.shellescape}`</span>

    <span class="ruby-identifier">config</span>[<span class="ruby-value">:git_default_branch</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-node">&quot;#{target}/.git/HEAD&quot;</span>).<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;/&quot;</span>).<span class="ruby-identifier">last</span>.<span class="ruby-identifier">chomp</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">templates</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">src</span>, <span class="ruby-identifier">dst</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">destination</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dst</span>)
    <span class="ruby-identifier">thor</span>.<span class="ruby-identifier">template</span>(<span class="ruby-node">&quot;newgem/#{src}&quot;</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">config</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">executables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">file</span>)
    <span class="ruby-identifier">executable</span> = (<span class="ruby-identifier">path</span>.<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">mode</span> <span class="ruby-operator">|</span> <span class="ruby-value">0o111</span>)
    <span class="ruby-identifier">path</span>.<span class="ruby-identifier">chmod</span>(<span class="ruby-identifier">executable</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">use_git</span>
    <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">target</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-string">`git add .`</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># Open gemspec in editor</span>
  <span class="ruby-identifier">open_editor</span>(<span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;edit&quot;</span>], <span class="ruby-identifier">target</span>.<span class="ruby-identifier">join</span>(<span class="ruby-node">&quot;#{name}.gemspec&quot;</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:edit</span>]

  <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;Gem &#39;#{name}&#39; was successfully created. &quot;</span> \
    <span class="ruby-string">&quot;For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-ask_and_set" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask_and_set</span><span
                                class="method-args">(key, header, message)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ask_and_set-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 254</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask_and_set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">header</span>, <span class="ruby-identifier">message</span>)
  <span class="ruby-identifier">choice</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>]
  <span class="ruby-identifier">choice</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-node">&quot;gem.#{key}&quot;</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">choice</span>.<span class="ruby-identifier">nil?</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">choice</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">confirm</span> <span class="ruby-identifier">header</span>
    <span class="ruby-identifier">choice</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">yes?</span> <span class="ruby-node">&quot;#{message} y/(n):&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>.<span class="ruby-identifier">set_global</span>(<span class="ruby-node">&quot;gem.#{key}&quot;</span>, <span class="ruby-identifier">choice</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">choice</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ask_and_set_ci" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask_and_set_ci</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ask_and_set_ci-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 312</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask_and_set_ci</span>
  <span class="ruby-identifier">ci_template</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:ci</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.ci&quot;</span>]

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ci_template</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">confirm</span> <span class="ruby-string">&quot;Do you want to set up continuous integration for your gem? &quot;</span> \
      <span class="ruby-string">&quot;Supported services:\n&quot;</span> \
      <span class="ruby-string">&quot;* CircleCI:       https://circleci.com/\n&quot;</span> \
      <span class="ruby-string">&quot;* GitHub Actions: https://github.com/features/actions\n&quot;</span> \
      <span class="ruby-string">&quot;* GitLab CI:      https://docs.gitlab.com/ee/ci/\n&quot;</span> \
      <span class="ruby-string">&quot;\n&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">hint_text</span>(<span class="ruby-string">&quot;ci&quot;</span>)

    <span class="ruby-identifier">result</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">ask</span> <span class="ruby-string">&quot;Enter a CI service. github/gitlab/circle/(none):&quot;</span>
    <span class="ruby-keyword">if</span> <span class="ruby-regexp">/github|gitlab|circle/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">result</span>)
      <span class="ruby-identifier">ci_template</span> = <span class="ruby-identifier">result</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">ci_template</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.ci&quot;</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>.<span class="ruby-identifier">set_global</span>(<span class="ruby-string">&quot;gem.ci&quot;</span>, <span class="ruby-identifier">ci_template</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:ci</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.ci&quot;</span>]
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;#{options[:ci]} is already configured, ignoring --ci flag.&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">ci_template</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ask_and_set_linter" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask_and_set_linter</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ask_and_set_linter-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 343</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask_and_set_linter</span>
  <span class="ruby-identifier">linter_template</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:linter</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.linter&quot;</span>]
  <span class="ruby-identifier">linter_template</span> = <span class="ruby-identifier">deprecated_rubocop_option</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">linter_template</span>.<span class="ruby-identifier">nil?</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">linter_template</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">confirm</span> <span class="ruby-string">&quot;Do you want to add a code linter and formatter to your gem? &quot;</span> \
      <span class="ruby-string">&quot;Supported Linters:\n&quot;</span> \
      <span class="ruby-string">&quot;* RuboCop:       https://rubocop.org\n&quot;</span> \
      <span class="ruby-string">&quot;* Standard:      https://github.com/standardrb/standard\n&quot;</span> \
      <span class="ruby-string">&quot;\n&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">hint_text</span>(<span class="ruby-string">&quot;linter&quot;</span>)

    <span class="ruby-identifier">result</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">ask</span> <span class="ruby-string">&quot;Enter a linter. rubocop/standard/(none):&quot;</span>
    <span class="ruby-keyword">if</span> <span class="ruby-regexp">/rubocop|standard/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">result</span>)
      <span class="ruby-identifier">linter_template</span> = <span class="ruby-identifier">result</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">linter_template</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.linter&quot;</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>.<span class="ruby-identifier">set_global</span>(<span class="ruby-string">&quot;gem.linter&quot;</span>, <span class="ruby-identifier">linter_template</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># Once gem.linter safely set, unset the deprecated gem.rubocop</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.rubocop&quot;</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>.<span class="ruby-identifier">set_global</span>(<span class="ruby-string">&quot;gem.rubocop&quot;</span>, <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:linter</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.linter&quot;</span>]
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;#{options[:linter]} is already configured, ignoring --linter flag.&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">linter_template</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ask_and_set_test_framework" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask_and_set_test_framework</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ask_and_set_test_framework-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 277</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask_and_set_test_framework</span>
  <span class="ruby-identifier">test_framework</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:test</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.test&quot;</span>]

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">test_framework</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">confirm</span> <span class="ruby-string">&quot;Do you want to generate tests with your gem?&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">hint_text</span>(<span class="ruby-string">&quot;test&quot;</span>)

    <span class="ruby-identifier">result</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">ask</span> <span class="ruby-string">&quot;Enter a test framework. rspec/minitest/test-unit/(none):&quot;</span>
    <span class="ruby-keyword">if</span> <span class="ruby-regexp">/rspec|minitest|test-unit/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">result</span>)
      <span class="ruby-identifier">test_framework</span> = <span class="ruby-identifier">result</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">test_framework</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.test&quot;</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>.<span class="ruby-identifier">set_global</span>(<span class="ruby-string">&quot;gem.test&quot;</span>, <span class="ruby-identifier">test_framework</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:test</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.test&quot;</span>]
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;#{options[:test]} is already configured, ignoring --test flag.&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">test_framework</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-bundler_dependency_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">bundler_dependency_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="bundler_dependency_version-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 395</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bundler_dependency_version</span>
  <span class="ruby-identifier">v</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>)
  <span class="ruby-identifier">req</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">segments</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>]
  <span class="ruby-identifier">req</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;a&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">prerelease?</span>
  <span class="ruby-identifier">req</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;.&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-deprecated_rubocop_option" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">deprecated_rubocop_option</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="deprecated_rubocop_option-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 379</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">deprecated_rubocop_option</span>
  <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value">:rubocop</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:rubocop</span>]
      <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span> <span class="ruby-value">2</span>, <span class="ruby-string">&quot;--rubocop is deprecated, use --linter=rubocop&quot;</span>
      <span class="ruby-string">&quot;rubocop&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span> <span class="ruby-value">2</span>, <span class="ruby-string">&quot;--no-rubocop is deprecated, use --linter&quot;</span>
      <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-operator">!</span><span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.rubocop&quot;</span>].<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">major_deprecation</span> <span class="ruby-value">2</span>,
      <span class="ruby-string">&quot;config gem.rubocop is deprecated; we&#39;ve updated your config to use gem.linter instead&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.rubocop&quot;</span>] <span class="ruby-operator">?</span> <span class="ruby-string">&quot;rubocop&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ensure_safe_gem_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ensure_safe_gem_name</span><span
                                class="method-args">(name, constant_array)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ensure_safe_gem_name-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 402</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ensure_safe_gem_name</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">constant_array</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/^\d/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;Invalid gem name #{name} Please give a name which does not start with numbers.&quot;</span>
    <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">constant_name</span> = <span class="ruby-identifier">constant_array</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;::&quot;</span>)

  <span class="ruby-identifier">existing_constant</span> = <span class="ruby-identifier">constant_array</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Object</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span>, <span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">defined</span> = <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">c</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">s</span>)
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
      <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;Invalid gem name #{name} -- `#{constant_name}` is an invalid constant name&quot;</span>
      <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">end</span>
    (<span class="ruby-identifier">defined</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">s</span>)) <span class="ruby-operator">||</span> <span class="ruby-keyword">break</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">existing_constant</span>
  <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;Invalid gem name #{name} constant #{constant_name} is already in use. Please choose another gem name.&quot;</span>
  <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-hint_text" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">hint_text</span><span
                                class="method-args">(setting)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="hint_text-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 303</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">hint_text</span>(<span class="ruby-identifier">setting</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-node">&quot;gem.#{setting}&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
    <span class="ruby-string">&quot;Your choice will only be applied to this gem.&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-string">&quot;Future `bundle gem` calls will use your choice. &quot;</span> \
    <span class="ruby-node">&quot;This setting can be changed anytime with `bundle config gem.#{setting}`.&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-open_editor" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">open_editor</span><span
                                class="method-args">(editor, file)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="open_editor-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 425</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">open_editor</span>(<span class="ruby-identifier">editor</span>, <span class="ruby-identifier">file</span>)
  <span class="ruby-identifier">thor</span>.<span class="ruby-identifier">run</span>(<span class="ruby-node">%(#{editor} &quot;#{file}&quot;)</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-required_ruby_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">required_ruby_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="required_ruby_version-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 433</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">required_ruby_version</span>
  <span class="ruby-string">&quot;2.6.0&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-resolve_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">resolve_name</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="resolve_name-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 250</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">resolve_name</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">pwd</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">basename</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-rubocop_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rubocop_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="rubocop_version-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 437</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rubocop_version</span>
  <span class="ruby-string">&quot;1.21&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-rust_builder_required_rubygems_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rust_builder_required_rubygems_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="rust_builder_required_rubygems_version-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 429</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rust_builder_required_rubygems_version</span>
  <span class="ruby-string">&quot;3.3.11&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-standard_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">standard_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="standard_version-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 441</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">standard_version</span>
  <span class="ruby-string">&quot;1.3&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-travis_removal_info" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">travis_removal_info</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>TODO: remove at next minor release</p>

                              <div class="method-source-code" id="travis_removal_info-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 446</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">travis_removal_info</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:ci</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;travis&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-string">&quot;Support for Travis CI was removed from gem skeleton generator.&quot;</span>
    <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-string">&quot;gem.ci&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;travis&quot;</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-string">&quot;Support for Travis CI was removed from gem skeleton generator, but it is present in bundle config. Please configure another provider using `bundle config set gem.ci SERVICE` (where SERVICE is one of github/gitlab/circle) or unset configuration using `bundle config unset gem.ci`.&quot;</span>
    <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_ext_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_ext_name</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_ext_name-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 267</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_ext_name</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">gem_name</span>.<span class="ruby-identifier">index</span>(<span class="ruby-string">&quot;-&quot;</span>)

  <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-string">&quot;You have specified a gem name which does not conform to the \n&quot;</span> \
                   <span class="ruby-string">&quot;naming guidelines for C extensions. For more information, \n&quot;</span> \
                   <span class="ruby-string">&quot;see the &#39;Extension Naming&#39; section at the following URL:\n&quot;</span> \
                   <span class="ruby-string">&quot;https://guides.rubygems.org/gems-with-extensions/\n&quot;</span>
  <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_rust_builder_rubygems_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_rust_builder_rubygems_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_rust_builder_rubygems_version-source">
            <pre><span class="ruby-comment"># File bundler/cli/gem.rb, line 458</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_rust_builder_rubygems_version</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rust_builder_required_rubygems_version</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">rubygems_version</span>
    <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;Your RubyGems version (#{Gem.rubygems_version}) is too old to build Rust extension. Please update your RubyGems using `gem update --system` or any other way and try again.&quot;</span>
    <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

